<!doctype html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
      layout:decorator="base"
      th:with="pageTitle='首页'">
<head>

</head>
<body>
<th:block layout:fragment="custom_content">
    <el-row>
        <el-col :span="10" style="margin-top:10px">
            <el-card class="box-card" >
                <div slot="header" class="clearfix">
                    <span>最新文件</span>
                    <el-button style="float: right; padding: 3px 0" type="text" @click="moreEditFile()">更多</el-button>
                </div>
                <div v-for="o in latestUpdList" class="text item">
                    <img src="/images/new.png" ><a :href="'/regulation/showregulation/'+o.id">{{ o.title +"&nbsp;&nbsp;"+o.updateTime}}</a>
                </div>
            </el-card>
        </el-col>
        <el-col :span="10" style="margin-left: 30px;margin-top:10px">
            <el-card class="box-card" >
                <div slot="header" class="clearfix">
                    <span>热搜文件</span>
                    <el-button style="float: right; padding: 3px 0" type="text" @click="moreHotSearch()">更多</el-button>
                </div>
                <div v-for="o in latestKwHotList" class="text item">
                    <img src="/images/hot.png" ><a :href="'/regulation/showregulation/'+o.id">{{o.title +"&nbsp;&nbsp;"+o.updateTime}}</a>
                </div>
            </el-card>

        </el-col>
    </el-row>
</th:block>
<th:block layout:fragment="javascript">
    <script>
        var indexVue = new Vue({
            el: '#app',
            data: function () {
                return {
                    menuWidth:'auto',
                    observer: null,
                    firedNum: 0,
                    recordOldValue: { // 记录下旧的宽高数据，避免重复触发回调函数
                        width: '0',
                        height: '0'
                    },
                    siderWidthDialog:false,
                    siderbarWidth:15,
                    openeds: ['1','163'],
                    isCollapse: false,
                    defaultIndex: '1',
                    latestUpdList: [],
                    latestKwHotList: [],
                    menus: [],
                    regulationMenus: [],
                    breadcrumbs:['首页'],
                    collapseTransition:false,
                    deptTrees:[]
                }
            },
            methods: {

                moreEditFile: function () {
                    location.href = "/index/moreeditfile";
                },
                moreHotSearch: function () {
                    location.href = "/index/morehotsearch";
                },
                initMenu: function () {
                    var $this = this;
                    var data = commonInitMenu($this);

                },
                toggleMenu: function () {
                    this.isCollapse = !this.isCollapse;
                    window.localStorage.setItem('isCollapse',this.isCollapse);
                },
                changeSiderWidth:function(value){
                    changeSiderWidth(this,value);
                },
                openChangeSiderWidth:function(){
                    this.siderWidthDialog=true;
                }
            },
            created: function () {
                initCssProperty(this);
            },

        });

        function init() {
            indexVue.initMenu();
        }

        $(function () {
            changeFooterHeight();
            init();
            var condition = {};
            $.ajax({
                cache: true,
                url: '/regulation/listLatestUpdFile?newDate='+Math.random(),
                type: 'POST',
                data: JSON.stringify(condition),
                dataType: 'json',
                contentType: 'application/json',
                async: false,
                success: function (data) {
                    indexVue.loading = false;
                    if (data.status == 1) {
                        var pageInfo = data.value;
                        indexVue.latestUpdList = pageInfo.list;
                    }
                }
            });

            condition = {};
            $.ajax({
                cache: true,
                url: '/regulation/listkeywordHot?newDate='+Math.random(),
                type: 'POST',
                data: JSON.stringify(condition),
                dataType: 'json',
                contentType: 'application/json',
                async: false,
                success: function (data) {
                    indexVue.loading = false;
                    if (data.status == 1) {
                        var pageInfo = data.value;
                        indexVue.latestKwHotList = pageInfo.list;
                    }
                }
            });
        });

    </script>
</th:block>
</body>
</html>